﻿<?php
    @session_start();
    include("template/head.php");

?>
	<style>
        	input[type="text"]{
        		height:30px !important;
        	}
        </style>
    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php include("template/menu_left.php") ?>                
        
        <div class="span10" id="content">
            <div class="row-fluid">
				<form id="formAddIntervention" class="form-horizontal" method="POST"  enctype="multipart/form-data"  action="submit/Articles/edit_article.php">
            <!-- block -->
                <!--  ************************ ROW ************************  -->
              <div class="span6">   
                 <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">Détail Article</div>
                        <input type="hidden" name="id_article" value="<?php echo $_GET['id_article'] ?>" />

                        <!-- .toolbar -->
                    </div>   
                    <div class="block-content collapse in" id="div-1">
                    <div class="control-group">  
                        <label class="control-label span4" for="ref_article">Référence</label>
                          <div class="controls">
                            <input type="text" name="ref_article" value="<?php echo $row->ref_article ?>" class="validate[required] form-control" placeholder="Réference article" id="form-validation-field-1">
				          </div>
                    </div>
                  <div class="control-group">  
                    <div>
                      <textarea id="comment" name="designation" placeholder="Désignation..." style="width:388px;height:100px;"><?php echo $row->designation; ?></textarea>
                    </div>
                  </div>
                   
                    <div class="control-group">
                        <label class="control-label span4" for="select01">Type</label>
                          <div class="controls">
                            <select class="validate[required] form-control" id="id_type" name="id_type">
        						<option value="<?php echo $row->id_type ?>"><?php echo getTypeArticle($row->id_type); ?></option>
	        					 <?php
			                        $table = "SELECT DISTINCT (`nom_type`), `id_type` FROM st_att_type_article ORDER BY nom_type ASC;";     
			                        $colonne = mysql_query($table);     
			                        while($data = mysql_fetch_array($colonne)){
			                            echo '<option value="'.$data["id_type"].'">'.$data["nom_type"].'</option>';
			                        }
			
			                    ?>
	        				</select>
                          </div>
                      </div> 
                        <div class="control-group">
                            <label class="control-label span4" for="pass1">Emplacement</label>
                            <div class="controls">
                                 <select id="id_emplacement" class="validate[required] form-control" name="id_emplacement" onchange='charger_modele()'>
	                      <option value="<?php echo $row->id_lieu; ?>"><?php echo getLieu($row->id_lieu)?></option>
	                        <?php
	                        $table = "SELECT DISTINCT (`nom_lieu`), `id_lieu` FROM st_att_lieu_article ORDER BY nom_lieu ASC;";     
	                        $colonne = mysql_query($table);     
	                        while($data = mysql_fetch_array($colonne)){
	                            echo '<option value="'.$data["id_lieu"].'">'.$data["nom_lieu"].'</option>';
	                        }
	
	                        ?>
	                    </select>
                            </div>
                        </div> 
                        <div class="control-group">
                            <label class="control-label span4" for="pass1">Prix de vente</label>
                            <div class="controls">
             		 			<input type="text" name="prix" class="validate[required,custom[number]] form-control" value="<?php echo $row->prix; ?>" placeholder="Prix de vente" id="form-validation-field-3">
                           	</div>
                        </div>
                        <div class="control-group">
                            <script>
								jQuery(document).ready(function($){
									$("#date_ajout").datepicker({ dateFormat: 'dd/mm/yy' });
								});
							 </script>
                            <label class="control-label span4" for="date_ajout" style="margin-left:0px;">Date d'ajout</label>
                            <div class="controls">
            				  <input type="text" name="date_ajout" id="date_ajout" value="<?php echo $row->date_add; ?>" class="form-control" placeholder="Date" id="form-validation-field-1">
                           	</div>
                        </div> 
                        <div class="control-group">
                            <div>
                          		<textarea id="comment" name="comment" placeholder="Observation..." style="width:388px;height:100px;"><?php echo $row->commentaire; ?></textarea>
                            </div>
                        </div>  
                             <!-- /.control-group -->
                    </div>
                    </div>
              </div>
            <!--  ************************ / ROW ************************  -->
            <!-- block -->
                <!--  ************************ ROW ************************  -->
              <div class="span6">   
                 <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">Photo</div>
                        <!-- .toolbar -->
                    </div>   
                    <div class="block-content collapse in" id="div-1">
                      <div class="form-control">
                        <label class="control-label span4">Image Upload</label>
                        <div class="span8">
                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                								<?php if(empty($row->photo_name)){ ?>
													<img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image">
                								<?php }else{ ?>
													<img src="<?php echo $row->photo_name ?>" >
                								<?php } ?>
                								</div>
                                
                                <div>
                                    <span class="btn btn-file btn-success"><span class="fileupload-new">Select image</span>
									<span class="fileupload-exists">Change</span>
									<input type="file" name="photo_article" id="photo_article"/></span>
                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">Remove</a>
                                </div>
								<div id="addsToForm"></div>
                            </div>
                        </div>
                      </div>
                    </div> 
                  </div>
                </div>     
			<!--  ************************ / ROW ************************  -->  
              <div class="span6">   
                 <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">Quantité</div>
                        <!-- .toolbar -->
                    </div>
                    <div class="block-content collapse in" id="div-1">
                      <div class="control-group">
                            <label class="control-label span3" for="pass1" >Quantité Minimal</label>
                            <div class="controls">
              					<input type="text" name="qte_min" value="<?php echo $row->Qte_min; ?>" class="validate[required,custom[integer]] form-control" placeholder="Qt min" id="form-validation-field-2">
                           </div>
                        </div> 
                        <div class="control-group">
                            <label for="comment" class="control-label span3" >Unité de stockage</label>
                            <div class="controls">
                             <select class="validate[required] form-control" id="id_unit" name="id_unit">
				                  <option value="<?php echo $row->id_unite_stockage?>"><?php echo getUnit($row->id_unite_stockage)?></option>
				                   <?php
				                        $table = "SELECT DISTINCT (`valeur`), `id_unite_stockage` FROM st_att_unite_stockage ORDER BY nb_pieces ASC;";     
				                        $colonne = mysql_query($table);     
				                        while($data = mysql_fetch_array($colonne)){
				                            echo '<option value="'.$data["id_unite_stockage"].'">'.$data["valeur"].'</option>';
				                        }
				
				                    ?>
				              </select>
                            </div>
                        </div>
					</div>				
                  </div>
              </div>
              <!--  ************************ / ROW ************************  -->			
              <div class="form-group">
                <div class="col-lg-8">
                    <input type="submit" value="Enregistrer" class="validate[required] span3 btn btn-primary" style="margin-bottom:1em; float: right;" name="marque_ajout" id="save">
               </div>
          </div>         
             </form>   
            
          
          </div>
            <hr>
        </div>
        <script type="text/javascript">     
        $('#datepicker').datepicker({
        	firstDay: 1,
          dateFormat: 'dd/mm/yyyy'	
		})
        </script>   
<?php  include("template/footer_form.php") ; ?>